import pymongo

__client = pymongo.MongoClient(host='localhost', port=27017)
__db = __client.mfw


def insert_city(mddid, name, en_name, nums):
    __db.cities.insert_one({
        "mddid": mddid,
        "name": name,
        "en_name": en_name,
        "nums": int(nums)
    })


def find_city(mddid):
    return __db.cities.find_one({"mddid":mddid})


def save_city(city):
    __db.cities.save(city)


def insert_user(user):
    __db.users.insert_one(user)


def find_user(uid):
    return __db.users.find_one({"uid":uid})


def save_user(user):
    __db.users.save(user)

